package com.lanbu.system.domain.mongo;

import lombok.Data;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.time.Instant;
import java.util.List;
import java.util.Map;

@Data
@Document(collection = "chats")  // 指定 MongoDB 集合名
public class MongoChats {
    @Id
    private ObjectId id;

    private ObjectId appId;

    private String chatId;

    @Field("__v")
    private Integer version;

    private String customTitle;

    private Metadata metadata;

    private String outLinkUid;

    private List<Object> pluginInputs; // pluginInputs 是空数组，这里用 Object 类型兼容

    private String shareId;

    private String source;

    private String sourceName;

    private ObjectId teamId;

    private String title;

    private ObjectId tmbId;

    private Boolean top;

    private Instant updateTime;

    private List<VariableListItem> variableList;

    private Map<String, Object> variables;

    private String welcomeText;

    @Data
    public static class Metadata {
        private String originIp;
    }

    @Data
    public static class VariableListItem {
        private String id;
        private String key;
        private String label;
        private String type;
        private String description;
        private Boolean required;
        private String valueType;
        private List<ValueLabelPair> list;
        private String defaultValue;
        private List<ValueLabelPair> enums;
    }

    @Data
    public static class ValueLabelPair {
        private String value;
        private String label;
    }
}
